package merlin.beans;

import merlin.utils.MerlinUtilities;

public class PDFReportFileBean{

	private String fileName;
	private byte[] fileData;
	private int reportZipped;

	public PDFReportFileBean(){
	}

	public PDFReportFileBean(String fName,byte[] data){
		setFileName(fName);
		this.fileData = data;
	}

	public String getFileName() {
		return fileName;
	}

	public void setFileName(String value) {
		value = MerlinUtilities.capitalizeFully(value);
		if(value.length()>20){
			value = value.substring(0,21) + "...";
		}
		fileName = "MSAL " + value + " Report.pdf";
	}

	public void setSpreadsheetDataFileName(String value){
		value = MerlinUtilities.capitalizeFully(value);
		if(value.length()>20){
			value = value.substring(0,21) + "...";
		}
		fileName = "MSALDATA " + value + ".xls";		
	}
	
	public byte[] getFileData() {
		return fileData;
	}

	public void setFileData(byte[] value) {
		fileData = value;
	}

	public int getReportZipped() {
		return reportZipped;
	}

	public void setReportZipped(int value) {
		reportZipped = value;
		// Append .zip after the file name if zipped is true.
		if(reportZipped == 1){
			fileName += ".zip";
		}
	}
}